{extend name="public/layer/main" /}
{block name="css"}{/block}
{block name="style"}{/block}
{block name="js"}{/block}
{block name="script"}
<script type="text/javascript">
	function changeCounty(obj) {
		var val = $(obj).val();

		var data = {
		    'p_code' : val,
		};
        $.post("{:url('getaddr')}", data, function(result){
			if ( result.status ) {
			    $('[name=county]').html(result.info);
			}
			else {
			    alert(result.info);
			}
        });
    }
</script>
{/block}
{block name="module"}{$globals.module}{/block}
{block name="controller"}{$globals.controller}{/block}
{block name="action"}{$globals.action}{/block}
{block name="desc"}{$globals.desc}{/block}
{block name="content"}
<div class="box box-primary">
	<div class="box-header with-border">
		<h3 class="box-title">搜索：</h3>
	</div>
	<form class="form-horizontal" action="{:url('page')}" method="get">
	<div class="box-body">
		<div class="form-group">
			{if $request.type == 1}
			<label class="col-md-1 control-label">地级市名称</label>
			<div class="col-md-2">
				<select class="form-control" rel-action="select" name="city" onchange="changeCounty(this);">
					<option value="">不限</option>
					{volist name="addr['city']" id="item"}
					{if isset($request.county) && $request.city == $item.code}
					<option value="{$item.code}" selected="selected">{$item.name}</option>
					{else /}
					<option value="{$item.code}">{$item.name}</option>
					{/if}
					{/volist}
				</select>
			</div>
			{/if}
			{if $request.type < 3}
			<label class="col-md-1 control-label">区县名称</label>
			<div class="col-md-2">
				<select class="form-control" rel-action="select" name="county">
					<option value="">不限</option>
					{if $request.type === 2 || empty($request.city) === false }
					{volist name="addr['county']" id="item"}
					{if isset($request.county) && $request.county == $item.code}
					<option value="{$item.code}" selected="selected">{$item.name}</option>
					{else /}
					<option value="{$item.code}">{$item.name}</option>
					{/if}
					{/volist}
					{/if}
				</select>
			</div>
			{/if}
			<label class="col-md-1 control-label">店铺名称</label>
			<div class="col-md-2">
				<input type="text" class="form-control" name="merchantShortName" value="{$request.merchantShortName|default=''}" placeholder="请输入店铺名称" autocomplete="off">
			</div>
			<label class="col-md-1 control-label">店铺手机号</label>
			<div class="col-md-2">
				<input type="text" class="form-control" name="mch_phone" value="{$request.mch_phone|default=''}" placeholder="请输入手机号" autocomplete="off">
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-1 control-label">商户号</label>
			<div class="col-md-2">
				<input type="text" class="form-control" name="user_id" value="{$request.user_id|default=''}" placeholder="请输入商户号" autocomplete="off">
			</div>
			<label class="col-md-1 control-label">进件时间</label>
			<div class="col-md-2">
				<div class="input-group">
					<input type="text" class="form-control" name="stime" value="{$request.stime|default=''}" placeholder="开始时间" autocomplete="off" rel-action="datepicker">
					<span class="input-group-addon border-none-left-right">-</span>
					<input type="text" class="form-control" name="etime" value="{$request.etime|default=''}" placeholder="截止时间" autocomplete="off" rel-action="datepicker">
				</div>
			</div>
		</div>
	</div>
	<div class="box-footer">
		<div class="col-md-offset-1">
			<button type="submit" class="btn btn-default">查询</button>
			<a class="btn btn-default" href="{:url('page')}">重置</a>
		</div>
	</div>
	</form>
</div>
<div class="box box-primary">
	<div class="box-header with-border">
		<h3 class="box-title">
			<a class="btn btn-default" href="{:url('excel', ['request' => json_encode($request, JSON_UNESCAPED_UNICODE)])}">
				<i class="fa fa-file-text"></i>
				导出
			</a>
		</h3>
		<div class="box-tools">
			<a class="btn btn-default" href="#">
				商家总数: {$data.data->total()}
			</a>
		</div>
	</div>
	<div class="box-body table-responsive">
		<table class="table table-bordered table-striped table-hover">
			<tbody>
				{notempty name="data.data"}
				<tr>
					<th class="text-center">编号</th>
					<th class="text-center">店铺名</th>
					<th class="text-center">商铺号</th>
					<th class="text-center">手机号</th>
					<th class="text-center">店铺地址</th>
					<th class="text-center">进件时间</th>
					<th class="text-center">经纪人编号</th>
					<th class="text-center">经纪人姓名</th>
					<th class="text-center">经纪人手机</th>
					<th class="text-center">操作</th>
				</tr>
				{volist name='data.data' id='items'}
				<tr>
					<td class="text-center">{$items.id}</td>
					<td class="text-center">{$items.merchantShortName}</td>
					<td class="text-center">{$items.user_id}</td>
					<td class="text-center">{$items.mch_phone}</td>
					<td class="text-center">{$items.address}</td>
					<td class="text-center">{$items.checkTime|default='暂无'}</td>
					<td class="text-center">{$items.tgnumber}</td>
					<td class="text-center">{$items.truename}</td>
					<td class="text-center">{$items.telephone}</td>
					<td class="text-center">
						<a href="{:url('detail', ['id' => $items.id, 'uid' => $items.uid])}">查看详情</a>
						<a href="{:url('wkOrder/sellerOrder', ['suid' => $items.uid])}">查看订单</a>
						<a href="{:url('wkSelerexDetail', ['uid' => $items.uid])}">推广信息</a>
					</td>
				</tr>
				{/volist}
				{else /}
				<tr>
					<td>暂无符合条件记录</td>
				</tr>
				{/notempty}
			</tbody>
		</table>
	</div>
	{notempty name="data.data"}
	<div class="box-footer clearfix">
		{$data.data->render()|raw}
	</div>
	{/notempty}
</div>
{/block}